<template>
  <div class="app-container">
    <div class="filter-container search_Top" style="margin: 0 15px 10px 15px">
      <div class="search_input_list" ref="searchHeight" :style="{height: inputMore.setHeight}">
        <div class="filter-item">
          <el-date-picker v-model="searchParam.startTime" placeholder="送检开始时间"
                          size="mini"
                          type="date"
                          format="yyyy-MM-dd"
                          value-format="yyyy-MM-dd"
                          style="width: 140px;"></el-date-picker>
          <span class="date_splite"></span>
          <el-date-picker v-model="searchParam.endTime" placeholder="送检结束时间"
                          size="mini"
                          type="date"
                          format="yyyy-MM-dd"
                          value-format="yyyy-MM-dd"
                          style="width: 140px;"></el-date-picker>
        </div>
        <div class="filter-item">
          <el-select v-model="searchParam.deptId" :disabled="tab == 'takeTask' || tab == 'myTask'" placeholder="部门"
                     size="mini"
                     clearable>
            <el-option v-for="item in deptList"
                       :key="item.id"
                       :label="item.deptName"
                       :value="item.id"/>
          </el-select>
        </div>
        <div class="filter-item">
          <el-select v-model="searchParam.userId" placeholder="用户" :disabled="tab == 'takeTask' || tab == 'myTask'"
                     size="mini"
                     clearable
                     filterable>
            <el-option v-for="item in loginList"
                       :key="item.id"
                       :label="item.userName"
                       :value="item.id"/>
          </el-select>
        </div>
        <div class="filter-item" v-show="tab == 'complete'">
          <el-input clearable v-model="searchParam.materialCode" placeholder="物料编码"
                    size="mini"
                    @keyup.enter.native="searchForm"/>
        </div>
        <!--<div class="filter-item">-->
        <!--<el-select v-model="searchParam.materialGradeId" placeholder="样品等级"-->
        <!--size="mini"-->
        <!--clearable>-->
        <!--<el-option v-for="item in codeItemMap.grade"-->
        <!--:key="item.id"-->
        <!--:label="item.itemName"-->
        <!--:value="item.id"/>-->
        <!--</el-select>-->
        <!--</div>-->
        <!--<div class="filter-item">-->
        <!--<el-select v-model="searchParam.locationId" placeholder="送样地点"-->
        <!--size="mini"-->
        <!--clearable>-->
        <!--<el-option v-for="item in codeItemMap.location"-->
        <!--:key="item.id"-->
        <!--:label="item.itemName"-->
        <!--:value="item.id"/>-->
        <!--</el-select>-->
        <!--</div>-->
        <div class="filter-item" v-show="tab == 'alldata'">
          <el-input clearable v-model="searchParam.materialName" placeholder="样品名称"
                    size="mini"
                    @keyup.enter.native="searchForm"/>
        </div>
        <div class="filter-item" v-show="tab == 'alldata'">
          <el-input clearable v-model="searchParam.sampleNum" placeholder="样品批号"
                    size="mini"
                    @keyup.enter.native="searchForm"/>
        </div>
        <div class="filter-item">
          <el-input clearable v-model="searchParam.sampleCode" placeholder="检验单号"
                    size="mini"
                    @keyup.enter.native="searchForm"/>
        </div>

        <div class="filter-item">
          <el-select v-model="searchParam.status" placeholder="状态"
                     size="mini"
                     clearable>
            <el-option v-for="item in statusMap"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value"/>
          </el-select>
        </div>


        <div class="filter-item">
          <el-select v-model="searchParam.results" placeholder="结果录入"
                     size="mini"
                     clearable>
            <el-option v-for="item in resultMap"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value"/>
          </el-select>
        </div>
      </div>
      <div class="filter-item filter-item-btn-search search_bt_list">
        <span class="gosearch" @click="searchForm">搜索</span>
        <span class="clears" @click="clearList">清除</span>
      </div>
      <div class="inputmore" @click="changeMore()" v-show="inputMore.showMore">
        <span v-if="inputMore.isMore">更多搜索 <i class="el-icon-arrow-down"></i></span>
        <span v-if="!inputMore.isMore">收起 <i class="el-icon-arrow-up"></i></span>
        <div class="triangle-bottomleft"></div>
        <div class="triangle-bottomright"></div>
      </div>
    </div>
    <div class="tab-container sample-detection" @click="inputJJ">
      <el-tabs style="margin-top:25px;" type="border-card" v-model="tab" @tab-click="tabClick">
        <el-tab-pane label="takeTask" name="takeTask" v-if="hasRole('tasking:check')">
          <span slot="label">待领任务<el-badge :value="takeTask.backCount"/></span>
          <div class="table_base_bt batch">
            <el-button v-if="hasRole('tasking:check:take')" class="filter-btn-item pllj" size="mini"
                       @click="batchTakeSample">
              批量领检
            </el-button>
          </div>
          <drug-table @getSelection="getSelection" :isMultipleSelection="true" :tableData="takeTask.tableData"
                      :tableLoading="takeTask.tableLoading" :tableHeader="takeTask.tableHeader"
                      :option="takeTask.option">
            <template slot-scope="props" slot="operate">
              <div v-if="hasRole('tasking:check:take')">
                <el-button type="primary"
                           icon="el-icon-edit-outline"
                           size="mini"
                           @click="handleDetection(props.rowData)">领检
                </el-button>
              </div>
            </template>
          </drug-table>
        </el-tab-pane>
        <el-tab-pane label="myTask" name="myTask" v-if="hasRole('mytask:check')">
          <span slot="label">我的任务<el-badge :value="myTask.backCount"/></span>
          <div class="app-my-task-container" v-if="loadTab.myTask">
            <el-row>
              <el-col :span="24">
                <div style="margin: 10px 15px 10px 15px;display:flex">
                  <span class="svg-container">
                    <i class="iconfont icon-saomafukuan-"></i>
                  </span>
                  <el-input clearable placeholder="请扫码录入" id="sampleCodeJJ" class="saomaInput"
                            style="width: 160px" autofocus v-model="sampleCode"
                            size="mini"/>
                </div>
              </el-col>
            </el-row>
            <drug-table @emitSpanFun="emitSpanFun" @getBackData="getMyTaskList" :backCount="myTask.backCount"
                        :tableData="myTask.tableData" :tableLoading="myTask.tableLoading"
                        :tableHeader="myTask.tableHeader" :option="myTask.option">
              <template slot-scope="props" slot="operate">
                <div>
                  <label @click="seeMyTask(props.rowData)" class="table-view">
                    查看
                  </label>
                  <label @click="printMyTask(props.rowData)" class="table-view">
                    · &nbsp;打印
                  </label>
                </div>
              </template>
            </drug-table>
          </div>
        </el-tab-pane>
        <el-tab-pane label="deptTask" name="deptTask" v-if="hasRole('dept:check')">
          <span slot="label">部门任务 </span>
          <dept-task ref="deptTaskRef" v-if="loadTab.deptTask"></dept-task>
        </el-tab-pane>
        <el-tab-pane label="waiting" name="waiting" v-if="hasRole('notake:check')">
          <span slot="label">待审核 </span>
          <wait-check ref="waitCheckRef" v-if="loadTab.waiting"></wait-check>
        </el-tab-pane>
        <el-tab-pane label="complete" name="complete" v-if="hasRole('complete:check')">
          <span slot="label">已完成 </span>
          <complete-check ref="completeCheckRef" v-if="loadTab.complete"></complete-check>
        </el-tab-pane>
        <el-tab-pane label="alldata" name="alldata" v-if="hasRole('all:check')">
          <span slot="label">全数据查询</span>
          <all-check ref="allCheckRef" v-if="loadTab.alldata"></all-check>
        </el-tab-pane>
      </el-tabs>
    </div>
    <take-task ref="takeTask"></take-task>
    <my-task></my-task>
  </div>
</template>

<script>
  import waves from '@/views/directive/waves' // waves directive
  import {parseTime} from '@/utils'
  import {formatDate} from '@/utils/formatDate'
  import {sortStr} from '@/utils/common'
  import drugTable from "@/components/table/index";
  import takeTask from "./dialog/takeTask"
  import myTask from "./dialog/myTask"
  import deptTask from "./deptTask"
  import waitCheck from "./waitCheck"
  import allCheck from "./allCheck"
  // import completeCheck from "./completeCheck"
  import completeCheck from "./complete-sample"
  import {getToken} from '@/utils/auth' // 验权

  import print from 'print-js'

  export default {
    components: {drugTable, takeTask, myTask, deptTask, waitCheck, completeCheck, allCheck},
    directives: {waves},

    data() {
      return {
        inputMore: {isMore: true, showMore: true, liConHeight: 36, setHeight: 36,},
        resultMap: [{label: "全部", value: ""}, {label: "已录入", value: "Y"}, {label: "未录入", value: "N"}],
        searchParam: {
          locationId: "",
          materialGradeId: "",
          sampleCode: "",
          materialCode: "",
          materialName: "",
          sampleNum: "",
          startTime: "",
          endTime: "",
          resultId: "",
          results: "",
          status: "",
          userId: "",
          deptId: "",
          // type:"",
          // testStaffId:""
        },

        codeItemMap: {location: [], type: [], dept: [], grade: [], scope: []},

        statusMap: [
          {label: "检测中", value: "SA"},
          {label: "审核中", value: "WA"},
          {label: "驳回", value: "RJ"},
          {label: "完成", value: "AP"},
        ],

        sampleCode: "",
        showTip: "",
        firstExc: true,
        myTaskSearchList: [],
        myTask: {
          tableData: [],
          tableHeader: [],
          tableLoading: true,
          count: 0,
          backCount: 0,
          readCount: 0,
          option: {showOperate: true},
        },
        takeTask: {
          tableData: [],
          tableHeader: [],
          tableLoading: true,
          count: 0,
          backCount: 0,
          option: {showOperate: true},
          selectChoice: [],
        },
        tab: "takeTask",

        deptList: [],
        loginList: [],

        loadTab: {takeTask: false, myTask: false, deptTask: false, waiting: false, complete: false, alldata: false},
      }
    },
    mounted() {
      let self = this;
      self.initPickerTime();
      self.getAllLogin();
      self.getItemCode();
      self.getChooseDeptList();
      self.getCurrentTab();
      self.getSearchSampleTask();
      self.getAllList();
      self.inputJJ();
      self.$eventBus.$on("initPickerTime", function () {
        self.initPickerTime();
      });
      self.$eventBus.$on("updateDetectionList", function () {
        self.getMyTaskList();
        self.getTakeTaskList();
        self.getSearchSampleTask();
        self.$refs.waitCheckRef.searchList(this.searchParam);
      });
      self.$eventBus.$on("autoInputJJ", function () {
        self.inputJJ();
      });
      self.changeMore()
    },
    methods: {

      tabClick(tab, event) {
        let self = this;
        let tabName = tab.name;
        if (!self.loadTab[tabName]) {
          self.loadTab[tabName] = true;
          self.$nextTick(() => {
            if (tabName == 'takeTask') {
              self.getTakeTaskList();
            }
            if (tabName == 'myTask') {
              self.getMyTaskList();
            }
            if (tabName == 'deptTask') {
              this.$refs.deptTaskRef.searchList(this.searchParam);
            }
            if (tabName == 'waiting') {
              this.$refs.waitCheckRef.searchList(this.searchParam);
            }
            if (tabName == 'complete') {
              this.$refs.completeCheckRef.searchList(this.searchParam);
            }
            if (tabName == 'alldata') {
              this.$refs.allCheckRef.searchList(this.searchParam);
            }
          })
        }
      },

      getItemCode() {
        let self = this;
        self.codeItemMap = {location: [], type: [], dept: [], grade: [], scope: []};
        self.$http({
          url: "/drug/codeItem/queryCodeItemList",
          method: "post",
        }).then(resp => {
          if (resp.success) {
            for (let data of resp.result) {
              if (self.codeItemMap.hasOwnProperty(data.itemCode)) {
                self.codeItemMap[data.itemCode].push(data);
              }
            }
          }
        });
      },
      getAllLogin() {
        let self = this;
        self.$http({
          url: "/drug/queryAllLoginList",
          method: "post",
        }).then(resp => {
          if (resp.success) {
            self.loginList = resp.result;
          }
        });
      },

      getChooseDeptList() {
        let self = this;
        self.$http({
          url: "/drug/dept/queryDeptChooseList",
          method: "post",
        }).then(resp => {
          if (resp.success) {
            if (resp.result.length > 0) {
              self.deptList = resp.result;
            }
          }
        });
      },

      getAllList() {
        let self = this;
        self.getMyTaskListCount();
        if (this.hasRole('tasking:check')) {
          self.getTakeTaskList();
          self.loadTab.takeTask = true;
        } else if (this.hasRole('mytask:check')) {
          self.getMyTaskList();
          self.loadTab.myTask = true;
        } else if (this.hasRole('dept:check')) {
          this.$refs.deptTaskRef.searchList(this.searchParam);
          self.loadTab.deptTask = true;
        } else if (this.hasRole('notake:check')) {
          this.$refs.waitCheckRef.searchList(this.searchParam);
          self.loadTab.waiting = true;
        } else if (this.hasRole('complete:check')) {
          this.$refs.completeCheckRef.searchList(this.searchParam);
          self.loadTab.complete = true;
        } else if (this.hasRole('all:check')) {
          this.$refs.allCheckRef.searchList(this.searchParam);
          self.loadTab.alldata = true;
        }
      },

      getCurrentTab() {
        if (this.hasRole('tasking:check')) {
          this.tab = 'takeTask';
        } else if (this.hasRole('mytask:check')) {
          this.tab = 'myTask';
        } else if (this.hasRole('dept:check')) {
          this.tab = 'deptTask';
        } else if (this.hasRole('notake:check')) {
          this.tab = 'waiting';
        } else if (this.hasRole('complete:check')) {
          this.tab = 'complete';
        } else if (this.hasRole('all:check')) {
          this.tab = 'alldata';
        }
      },

      seeMyTask(data) {
        let row = Object.assign({}, data);
        this.$eventBus.$emit("openMyTaskDialog", row, "see");
      },
      printMyTask(row) {
        console.log(row)
        let self = this;
        let param = {sampleCode: row.sampleId, userId: self.$store.getters.userId}
        self.$confirm('只有一次打印机会，是否打印？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          self.$http({
            url: "/drug/record/queryRecordLogList",
            method: "post",
            params: param
          }).then(resp => {
            if (resp.success) {
              if (resp.result.length != 1) {
                self.$notify({
                  title: '提示',
                  message: "查询打印记录出错！",
                  type: 'warning'
                });
                return;
              }
              let printData = resp.result[0];
              let printNum = parseInt(printData.printNum);
              if (printNum > 0) {
                self.$notify({
                  title: '提示',
                  message: "已经打印过，无法再次打印",
                  type: 'warning'
                });
                return;
              }
              let filePath = printData.filePath;
              if (!filePath) {
                self.$notify({
                  title: '提示',
                  message: "未查询到文件路径",
                  type: 'warning'
                });
                return;
              }
              self.$http({
                url: "/drug/sample/getFileBase",
                method: "post",
                params: {filePath: filePath}
              }).then(resp => {
                if (resp.success) {
                  print({printable: resp.result, type: 'pdf', base64: true});
                  self.$http({
                    url: "/drug/record/updateRecordLog",
                    method: "post",
                    params: {id: printData.id}
                  }).then(resp => {
                  });
                }
              });
            } else {
              self.$notify({
                title: '提示',
                message: "未查询到打印单！",
                type: 'warning'
              });
            }
          });
        });
      },
      async batchTakeSample() {
        let self = this;
        if (this.takeTask.selectChoice.length == 0) {
          self.$notify({
            title: '提示',
            message: "至少选择一条记录！",
            type: 'warning'
          });
          return
        }
        const loading = this.$loading({
          lock: true,
          text: '批量领检中...',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });
        self.$refs.takeTask.batchSampleEvent(this.takeTask.selectChoice).then(rows => {
          let sampleId = "";
          for (let row of rows) {
            if (row.submit == "error") {
              sampleId += ',' + sampleId
            }
          }
          loading.close();
          if (sampleId) {
            self.$notify({
              title: '提示',
              message: "检验单号" + sampleId + "领检失败",
              type: 'error'
            });
          } else {
            self.$notify({
              title: '提示',
              message: "领检成功",
              type: 'success'
            });
          }
          for (let key in self.searchParam) {
            self.searchParam[key] = '';
          }
          self.getMyTaskList();
          self.getTakeTaskList();
          self.getSearchSampleTask();
        });
      },

      getSelection(val) {
        this.takeTask.selectChoice = val;
      },
      initPickerTime() {
        let nowDate = formatDate(new Date(), "yyyy-MM-dd");
        let beforeMoth = new Date().getTime() - 3 * 30 * 24 * 3600 * 1000;
        let mouth = formatDate(new Date(beforeMoth), "yyyy-MM-dd");
        this.searchParam.startTime = mouth;
        this.searchParam.endTime = nowDate;
      },
      inputJJ() {
        let input = document.getElementById('sampleCodeJJ');
        if (input) {
          input.focus();
        }
      },

      handleDetection(rowData) {
        let data = Object.assign({}, rowData);
        this.$eventBus.$emit("openTakeTaskDialog", data, "add");
      },
      searchForm() {
        if (this.tab == 'myTask') {
          this.getMyTaskList();
          this.getSearchSampleTask();
        }
        if (this.tab == 'takeTask') {
          this.getTakeTaskList();
        }
        if (this.tab == 'deptTask') {
          this.$refs.deptTaskRef.searchList(this.searchParam);
        }
        if (this.tab == 'waiting') {
          this.$refs.waitCheckRef.searchList(this.searchParam);
        }
        if (this.tab == 'complete') {
          this.$refs.completeCheckRef.searchList(this.searchParam);
        }
        if (this.tab == 'alldata') {
          this.$refs.allCheckRef.searchList(this.searchParam);
        }

      },
      clearList() {
        let self = this;
        if (self.tab == 'myTask') {
          for (let key in self.searchParam) {
            self.searchParam[key] = "";
          }
          self.getMyTaskList();
        }
        if (self.tab == 'takeTask') {
          for (let key in self.searchParam) {
            self.searchParam[key] = "";
          }
          self.getTakeTaskList();
        }
        if (self.tab == 'deptTask') {
          for (let key in self.searchParam) {
            self.searchParam[key] = "";
          }
          let searchParam = Object.assign({}, self.searchParam);
          self.$eventBus.$emit("updateDeptTaskSampleItemList", searchParam);
        }
      },
      getMyTaskList(startIndex, pageRow) {
        let self = this;
        self.myTask.tableData = [];
        self.myTask.tableLoading = true;
        let searchParam = Object.assign({}, this.searchParam);
        if (searchParam.endTime) {
          searchParam.endTime = searchParam.endTime + " 23:59:59";
        }
        searchParam.deptId = '';
        searchParam.userId = '';
        let start = typeof startIndex == "number" ? startIndex : 0;
        let total = typeof pageRow == "number" ? pageRow : 15;
        searchParam.startIndex = start;
        searchParam.totalPage = total;
        // searchParam.notStatus = "AP";
        searchParam.userId = self.$store.getters.userId;
        self.$http({
          url: "/drug/sampleItem/querySampleItemList",
          method: "post",
          params: searchParam
        }).then(resp => {
          if (resp.success) {
            for (let data of resp.result) {
              data.itemCount = data.singleCount + "/" + data.totalCount;
              if (data.checkStatus == 'ZZ') {
                data.color = 'task_red'
              }
            }
            console.log('------------myTask-----------------')
            console.log(resp.result)
            self.myTask.tableLoading = false;
            self.myTask.tableData = resp.result;
            if (self.myTask.tableData.length > 0) {
              self.myTask.backCount = self.myTask.tableData[0].count;
              self.myTask.readCount = self.myTask.tableData[0].readCount;
            } else {
              self.myTask.backCount = 0;
              self.myTask.readCount = 0;
            }
            self.myTask.tableHeader = [
              {"columnName": "sampleId", "coloumNameCn": "检验单号"},
              {"columnName": "deptName", "coloumNameCn": "申请部门"},
              {"columnName": "userName", "coloumNameCn": "申请人", "width": "70px"},
              {"columnName": "createTimeSecondFt", "coloumNameCn": "送检时间"},
              {"columnName": "materialCode", "coloumNameCn": "物料编码"},
              {"columnName": "materialName", "coloumNameCn": "样品名称"},
              {"columnName": "sampleNum", "coloumNameCn": "样品批号"},
              {"columnName": "materialType", "coloumNameCn": "样品规格"},
              {"columnName": "materialGrade", "coloumNameCn": "样品等级"},
              {"columnName": "location", "coloumNameCn": "地点"},
              {"columnName": "itemCount", "coloumNameCn": "检项数"},
              {"columnName": "resultIdCn", "coloumNameCn": "结果录入"},
              {"columnName": "updateTimeFt", "coloumNameCn": "录入时间"},
              {"columnName": "checkStatusCn", "coloumNameCn": "状态", "isClick": true},];
            self.myTask.option.showOperate = true;
          }
        });
      },

      getMyTaskListCount() {
        let self = this;
        let searchParam = Object.assign({}, this.searchParam);
        if (searchParam.endTime) {
          searchParam.endTime = searchParam.endTime + " 23:59:59";
        }
        searchParam.deptId = '';
        searchParam.userId = '';
        searchParam.userId = self.$store.getters.userId;
        self.$http({
          url: "/drug/sampleItem/querySampleItemListCount",
          method: "post",
          params: searchParam
        }).then(resp => {
          if (resp.success) {
            self.myTask.backCount = resp.result;
          }
        });
      },

      openMyTaskDialog(data) {
        let row = Object.assign({}, data);
        if (!row.filePathName) {
          row.filePathName = "";
        }
        if (!row.resetPathName) {
          row.resetPathName = "";
        }
        this.$eventBus.$emit("openMyTaskDialog", row, "edit");
      },

      getSearchSampleTask() {
        let self = this;
        self.$http({
          url: "/drug/sampleItem/querySampleWithEdit",
          method: "post",
        }).then(resp => {
          if (resp.success) {
            self.myTaskSearchList = resp.result;
          }
        });
      },

      emitSpanFun(row) {
        let self = this;
        self.$http({
          url: "/drug/fmApprove/queryFmApproveByRelateId",
          method: "post",
          params: {relateId: row.sId}
        }).then(resp => {
          if (resp.success) {
            this.$alert(resp.result.content, '审核意见');
          }
        });
      },

      getTakeTaskList(startIndex, pageRow) {
        let self = this;
        self.takeTask.tableLoading = true;
        let searchParam = Object.assign({}, this.searchParam);
        if (searchParam.endTime) {
          searchParam.endTime = searchParam.endTime + " 23:59:59";
        }

        let user = JSON.parse(getToken());
        searchParam.deptId = user.deptId;
        delete searchParam.userId;
        self.$http({
          url: "/drug/sampleItem/queryTakeSampleItemList",
          method: "post",
          params: searchParam
        }).then(resp => {
          if (resp.success) {
            self.takeTask.tableLoading = false;
            self.takeTask.tableData = resp.result;
            self.takeTask.backCount = self.takeTask.tableData.length;
            resp.result = sortStr(resp.result, "sampleId");
            for (let data of resp.result) {
              data.itemCount = data.singleCount + "/" + data.totalCount;
            }
            self.takeTask.tableHeader = [
              {"columnName": "sampleId", "coloumNameCn": "检验单号"},
              {"columnName": "deptName", "coloumNameCn": "申请部门"},
              {"columnName": "userName", "coloumNameCn": "申请人", "width": "70px"},
              {"columnName": "createTimeSecondFt", "coloumNameCn": "送检时间"},
              {"columnName": "materialCode", "coloumNameCn": "物料编码"},
              {"columnName": "materialName", "coloumNameCn": "样品名称"},
              {"columnName": "sampleNum", "coloumNameCn": "样品批号"},
              {"columnName": "materialType", "coloumNameCn": "样品规格"},
              {"columnName": "materialGrade", "coloumNameCn": "样品等级"},
              {"columnName": "location", "coloumNameCn": "地点"},
              {"columnName": "itemCount", "coloumNameCn": "检项数"},
              {"columnName": "updateTimeFt", "coloumNameCn": "录入时间"},
              {"columnName": "checkStatusCn", "coloumNameCn": "状态"},];
            self.takeTask.option.showOperate = true;
          }
        });
      },
      changeMore() {
        let liCon = this.$refs.searchHeight;
        let height = liCon.offsetHeight
        if (height == this.inputMore.liConHeight) {
          this.inputMore.isMore = false
          liCon.style.height = 'auto'
          height = liCon.offsetHeight
          this.inputMore.setHeight = height + 'px';
        } else {
          this.inputMore.isMore = true
          this.inputMore.setHeight = this.inputMore.liConHeight + 'px'
        }
        if (this.inputMore.setHeight == '36px' && !this.inputMore.isMore) {
          this.inputMore.showMore = false
        }
      },
    },
    watch: {
      sampleCode(val) {
        let self = this;
        if (!val) {
          return;
        }
        setTimeout(function () {
          if (self.firstExc) {
            self.firstExc = false;
            if (self.showTip) {
              self.$notify({
                title: '提示',
                message: self.showTip,
                type: 'error'
              });
              self.sampleCode = "";
            }
            setTimeout(function () {
              self.firstExc = true;
            }, 2000);
          }
        }, 1000);
        if (this.myTaskSearchList.length == 0) {
          this.showTip = "操作无效！";
        }
        for (let data of this.myTaskSearchList) {
          if (val == data.sampleId && (data.checkStatus == 'SA' || data.checkStatus == 'RJ' || data.checkStatus == 'ZZ')) {
            self.openMyTaskDialog(data);
            self.showTip = "";
            self.sampleCode = "";
            self.firstExc = true;
            break;
          }
          if (val == data.sampleId && data.checkStatus != 'SA') {
            this.showTip = "操作无效！";
            break;
          }
          this.showTip = "编码出错啦！";
        }
      }
    }
  }
</script>

<style lang="scss">
  .el-div-review {
    .el-table .el-table__header th {
      background-color: #c55a0e;
    }
  }

  .el-dialog {
    .el-table .el-input__inner {
      border: 0px;
      background-color: transparent;
    }
  }
</style>

<style lang="scss" scoped>
  .app-container {
    padding: 20px 0;
  }

  .sample-detection .drugTable {
    margin: 0px 15px 15px 15px !important;
  }

  .svg-container {
    vertical-align: middle;
    width: 30px;
    display: inline-block;
    background: #409EFF;
    display: flex;
    align-items: center;
    justify-content: center;

    .iconfont {
      font-size: 20px;
      text-align: center;
      color: #fff;
    }
  }

  .el-dialog .dialog-footer .el-button--primary {
    background-color: #2e827f;
    border-color: #2e827f;
    border-radius: 3px;
    padding: 5px 10px;
  }

  .cell_over.drugTable {
    margin: 15px;
  }

  .table_base_bt.batch {
    padding: 10px 30px;

    .pllj {
      background: #67C23A;
    }
  }
</style>
